package com.youyi.yyviewsdklibrary.picker.impl;


import com.youyi.yyviewsdklibrary.picker.contract.TimeFormatter;
import com.youyi.yyviewsdklibrary.picker.widget.TimeWheelLayout;

public class SimpleTimeFormatter implements TimeFormatter {
    private final TimeWheelLayout wheelLayout;

    public SimpleTimeFormatter(TimeWheelLayout timeWheelLayout) {
        this.wheelLayout = timeWheelLayout;
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.TimeFormatter
    public String formatHour(int i) {
        String str;
        StringBuilder sb;
        if (this.wheelLayout.isHour12Mode()) {
            if (i == 0) {
                i = 24;
            }
            if (i > 12) {
                i -= 12;
            }
        }
        if (i < 10) {
            sb = new StringBuilder();
            str = "0";
        } else {
            sb = new StringBuilder();
            str = "";
        }
        sb.append(str);
        sb.append(i);
        return sb.toString();
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.TimeFormatter
    public String formatMinute(int i) {
        String str;
        StringBuilder sb;
        if (i < 10) {
            sb = new StringBuilder();
            str = "0";
        } else {
            sb = new StringBuilder();
            str = "";
        }
        sb.append(str);
        sb.append(i);
        return sb.toString();
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.TimeFormatter
    public String formatSecond(int i) {
        String str;
        StringBuilder sb;
        if (i < 10) {
            sb = new StringBuilder();
            str = "0";
        } else {
            sb = new StringBuilder();
            str = "";
        }
        sb.append(str);
        sb.append(i);
        return sb.toString();
    }
}
